home *** CD-ROM | disk | FTP | other *** search
/ PC go! 2008 April / PCgo 2008-04 (DVD).iso / interface / contents / demoversionen_3846 / 13664 / files / Data1.cab / frmsampleprint.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-10-16  |  5.7 KB  |  190 lines

  1. VERSION 5.00
  2. Begin VB.Form frmSamplePrint 
  3.    AutoRedraw      =   -1  'True
  4.    Caption         =   "In process server "
  5.    ClientHeight    =   6630
  6.    ClientLeft      =   2235
  7.    ClientTop       =   1710
  8.    ClientWidth     =   7815
  9.    LinkTopic       =   "Form1"
  10.    PaletteMode     =   1  'UseZOrder
  11.    ScaleHeight     =   6630
  12.    ScaleWidth      =   7815
  13.    Begin VB.CommandButton Command1 
  14.       Caption         =   "Refresh"
  15.       Height          =   360
  16.       Left            =   6255
  17.       TabIndex        =   5
  18.       Top             =   2535
  19.       Width           =   1140
  20.    End
  21.    Begin VB.CommandButton Print1 
  22.       Caption         =   "Print"
  23.       Enabled         =   0   'False
  24.       Height          =   495
  25.       Left            =   6240
  26.       TabIndex        =   4
  27.       Top             =   1800
  28.       Width           =   1215
  29.    End
  30.    Begin VB.CommandButton Exit 
  31.       Caption         =   "Exit"
  32.       Height          =   495
  33.       Left            =   6240
  34.       TabIndex        =   3
  35.       Top             =   5520
  36.       Width           =   1215
  37.    End
  38.    Begin VB.CommandButton SavetoFile 
  39.       Caption         =   "Save to File"
  40.       Enabled         =   0   'False
  41.       Height          =   495
  42.       Left            =   6240
  43.       TabIndex        =   2
  44.       ToolTipText     =   "Save editing drawing to new File"
  45.       Top             =   1080
  46.       Width           =   1215
  47.    End
  48.    Begin VB.CommandButton OpenFile 
  49.       Caption         =   "Open File"
  50.       Height          =   495
  51.       Left            =   6240
  52.       TabIndex        =   1
  53.       ToolTipText     =   "Add existing file"
  54.       Top             =   240
  55.       Width           =   1215
  56.    End
  57.    Begin VB.PictureBox Frame1 
  58.       AutoRedraw      =   -1  'True
  59.       AutoSize        =   -1  'True
  60.       BackColor       =   &H80000009&
  61.       Height          =   5745
  62.       Left            =   360
  63.       MousePointer    =   2  'Cross
  64.       ScaleHeight     =   379
  65.       ScaleMode       =   3  'Pixel
  66.       ScaleWidth      =   363
  67.       TabIndex        =   0
  68.       Top             =   255
  69.       Width           =   5505
  70.    End
  71. Attribute VB_Name = "frmSamplePrint"
  72. Attribute VB_GlobalNameSpace = False
  73. Attribute VB_Creatable = False
  74. Attribute VB_PredeclaredId = True
  75. Attribute VB_Exposed = False
  76. '******************************************************************'
  77. '*                                                                *'
  78. '*                      TurboCAD for Windows                      *'
  79. '*                   Copyright (c) 1993 - 2001                    *'
  80. '*             International Microcomputer Software, Inc.         *'
  81. '*                            (IMSI)                              *'
  82. '*                      All rights reserved.                      *'
  83. '*                                                                *'
  84. '******************************************************************'
  85. Option Explicit
  86. Private Sub Command1_Click()
  87.     Frame1.Refresh
  88.     Vi.Refresh
  89. End Sub
  90. Private Sub OpenFile_Click()
  91.     On Error GoTo ErrorHandler
  92.     'open cad file and create graphics object
  93. Dim CadFile As String
  94.     CadFile = App.Path & "\testcad.tcw"
  95.     Set Dr = Drs.Open(CadFile)
  96.     Set Bls = Dr.Blocks ' Blocks collection
  97.     Set Vis = Dr.Views
  98.     Set Vi = Vis.Add(, Frame1.hDC)
  99.     Vi.ScreenTop = Frame1.ScaleTop
  100.     Vi.ScreenLeft = Frame1.ScaleTop
  101.     Vi.ScreenHeight = Frame1.ScaleHeight
  102.     Vi.ScreenWidth = Frame1.ScaleWidth
  103.     Vi.ZoomToExtents
  104.     Frame1.Refresh
  105.     Vi.Refresh
  106.     SavetoFile.Enabled = True
  107.     Print1.Enabled = True
  108.     Exit Sub
  109. ErrorHandler:
  110.     MsgBox Err.Description
  111. End Sub
  112. Private Sub Exit_Click()
  113.     On Error GoTo ErrorHandler
  114.     Call Finish
  115.         Unload Me
  116.     Exit Sub
  117. ErrorHandler:
  118.     MsgBox ("Form_Exit " & Err.Description)
  119. End Sub
  120. Private Sub Form_Load()
  121.     On Error GoTo ErrorHandler
  122.     Set objApp = CreateObject("IMSIGX.Application")
  123.     If objApp Is Nothing Then
  124.         MsgBox "Could not start server.  " & Err.Description & "  Quitting."
  125.         Exit Sub
  126.     End If
  127.     Set Drs = objApp.Drawings
  128.     If Drs Is Nothing Then
  129.         MsgBox "Bad server.  " & Err.Description & "  Quitting"
  130.         Exit Sub
  131.     End If
  132.     Exit Sub
  133. ErrorHandler:
  134.     MsgBox ("Form_Load " & Err.Description)
  135. End Sub
  136. Private Sub Form_Paint()
  137.     On Error GoTo ErrorHandler
  138.     If Vi Is Nothing Then
  139.         Exit Sub
  140.     Else
  141.         Vi.ZoomToExtents
  142.     End If
  143.     Exit Sub
  144. ErrorHandler:
  145.     MsgBox ("Form_Paint " & Err.Description)
  146. End Sub
  147. Private Sub Form_Unload(Cancel As Integer)
  148.     On Error GoTo ErrorHandler
  149.     Call Finish
  150.     Exit Sub
  151. ErrorHandler:
  152.     MsgBox ("Form_Unload " & Err.Description)
  153. End Sub
  154. Private Sub Frame1_Paint()
  155.     If Vi Is Nothing Then
  156.         Exit Sub
  157.     Else
  158.         Vi.ZoomToExtents
  159.     End If
  160. End Sub
  161. Private Sub Print1_Click()
  162.     Dim PrintServer As PrintDr
  163.     Dim objDr As Object
  164.     Set PrintServer = New PrintDr
  165.     If (Printers.Count = 0) Then
  166.         MsgBox "There is not printer(s) defined"
  167.         Exit Sub
  168.     End If
  169.     Set objDr = Dr
  170.     Set Printer = Printers(1) ' choose a default printer
  171.     PrintServer.PrintAll Dr, Printer.hDC
  172. End Sub
  173. Private Sub SavetoFile_Click()
  174.     On Error GoTo ErrorHandler
  175.     Dim CadFileSave As String
  176.     CadFileSave = App.Path & "\testcadsave.tcw"
  177.     Dr.SaveAs (CadFileSave)
  178.     MsgBox ("The current drawing is saved to " & App.Path & "\testcadsave.tcw" & " file.")
  179.     Exit Sub
  180. ErrorHandler:
  181.     MsgBox ("FileSave" & Err.Description)
  182. End Sub
  183. Private Sub Finish()
  184.     Set Vi = Nothing
  185.     Set Vis = Nothing
  186.     Set Dr = Nothing
  187.     Set Drs = Nothing
  188.     Set objApp = Nothing
  189. End Sub
  190.